package com.bringway.p2p.controller;

import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;

import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.bringway.framework.controller.JsonController;
import com.bringway.framework.util.RequestUtils;
import com.bringway.global.domain.SysUserDetails;
import com.bringway.p2p.service.JhnxmService;

/**  
 * @类名 JhnxmController  
 * @功能 TODO  计划内项目界面
 * @作者 js 
 * @日期 2016年7月4日 上午9:26:44  
 *    
 */
@Controller
@RequestMapping("/jhn")
public class JhnxmController extends JsonController{
	Logger logger =Logger.getLogger(JhnxmController.class);
	
	@Autowired
	private JhnxmService jhnxmService ;
	
	/**
	 * 
	 * @param request 计划内债权录入
	 * @param response 查询功能
	 * @return
	 * @throws Exception
	 */
	
	@RequestMapping("/queryJhnzqList")
	public ModelAndView queryJhnzqList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String startDate = RequestUtils.getStringParameter(request, "startDate");
		String endDate = RequestUtils.getStringParameter(request, "endDate");
		
		String czqmc = RequestUtils.getStringParameter(request, "czqmc");
		String cssr = RequestUtils.getStringParameter(request, "cssr");
		String clrr = RequestUtils.getStringParameter(request, "clrr");
		String cxmlx = RequestUtils.getStringParameter(request, "cxmlx");
		String cxmzt = RequestUtils.getStringParameter(request, "cxmzt");
		String kyje = RequestUtils.getStringParameter(request, "kyje");
		String zhzt = RequestUtils.getStringParameter(request, "czhzt");
		params.put("start", start);
		params.put("limit", limit);
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("czqmc", czqmc);
		params.put("cssr", cssr);
		params.put("clrr", clrr);
		params.put("cxmlx", cxmlx);
		params.put("cxmzt", cxmzt);
		params.put("kyje", kyje);
		params.put("zhzt", zhzt);
		List list = jhnxmService.queryJhnzqList(params);
		int count = jhnxmService.getJhnzqCount(params);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	
	/**
	 * @作者 js  
	 * @方法名 saveJhnzq  
	 * @功能 TODO 保存债权录入
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/saveJhnzq")
	public ModelAndView saveJhnzq(HttpServletRequest request,HttpServletResponse response) throws Exception{
		SysUserDetails sysUserDetails =	(SysUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		String gyh = sysUserDetails.getGyh();
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String zqmc = RequestUtils.getStringParameter(request, "zqmc");//债权名称
		String zqssr = RequestUtils.getStringParameter(request, "zqssr");//债权所属人姓名
		String sjhm = RequestUtils.getStringParameter(request, "sjhm");//债权所属人手机号码
		String sfznum = RequestUtils.getStringParameter(request, "sfznum");//债权所属人身份证号码
		String kssj = RequestUtils.getStringParameter(request, "kssj");//债权开始时间
		String jssj = RequestUtils.getStringParameter(request, "jssj");//债权结束时间
		String zqje = RequestUtils.getStringParameter(request, "zqje");//债权金额
		String zqlx = RequestUtils.getStringParameter(request, "zqlx");//债权金额
		
		String atts = RequestUtils.getStringParameter(request, "atts");//附件
		
		params.put("zqmc", zqmc);
		params.put("zqssr", zqssr);
		params.put("sjhm", sjhm);
		params.put("sfznum", sfznum);
		params.put("kssj", kssj);
		params.put("jssj", jssj);
		params.put("zqje", zqje);
		params.put("gyh", gyh);
		params.put("zqlx", zqlx);
		params.put("atts", atts);
		
			boolean bool=jhnxmService.saveJhnzq(params);
			result.put("success", true);
			result.put("isAddSuc", bool);
		serialize(request,response,result);
		return null;
	}
	/**
	 * 
	 * @param request 债权录入删除功能
	 * @param response
	 * @return
	 * @throws Exception
	 *//*
	@RequestMapping("/deleteJhnzq")
	public ModelAndView deleteJhnzq(HttpServletRequest request,HttpServletResponse response) throws Exception{
		SysUserDetails sysUserDetails =	(SysUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String bizId = RequestUtils.getStringParameter(request, "bizId");
		String gyh=sysUserDetails.getGyh();
		params.put("bizId", bizId);
		try{
			Map<String,Object> zqInfoMap = jhnxmService.getJhnzqInfo(params);
			if(null !=zqInfoMap){
				if(zqInfoMap.containsKey("ZQ_STATE") && "00".equals(zqInfoMap.get("ZQ_STATE")) && gyh.equals(zqInfoMap.get("ZQ_OPER_USER_ID"))){
					jhnxmService.deleteJhnzq(params);
					result.put("isDeleteSuc", true);
					result.put("msg", "删除成功!");
				}else{
					result.put("isDeleteSuc", false);
					result.put("msg", "对不起,无法删除非本人申请记录!");
				}
			}else{
				result.put("isDeleteSuc", false);
				result.put("msg", "对不起,信息不存在!");
			}
		}catch(Exception e){
			e.printStackTrace();
			result.put("isDeleteSuc", false);
			result.put("msg", "对不起,数据异常!");
			logger.info("deleteJhnzq 删除计划内债权失败！"+ params.toString());
		}
		result.put("success", true);
		serialize(request,response,result);
		return null;
	}*/
	/**
	 * @作者 js  
	 * @方法名 queryJhncgList  
	 * @功能 TODO 查询计划内 草稿
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryJhncgList")
	public ModelAndView queryJhncgList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String startDate = RequestUtils.getStringParameter(request, "startDate");
		String endDate = RequestUtils.getStringParameter(request, "endDate");
		
		String cxmmc = RequestUtils.getStringParameter(request, "cxmmc");
		String cfbr = RequestUtils.getStringParameter(request, "cfbr");
		String cxmlx = RequestUtils.getStringParameter(request, "cxmlx");
		String cxmzt = RequestUtils.getStringParameter(request, "cxmzt");
		params.put("start", start);
		params.put("limit", limit);
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("cxmmc", cxmmc);
		params.put("cfbr", cfbr);
		params.put("cxmlx", cxmlx);
		params.put("cxmzt", cxmzt);
		List list = jhnxmService.queryJhncgList(params);
		int count = jhnxmService.getJhncgCount(params);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 saveJhncg  
	 * @功能 TODO 保存计划内 草稿
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/saveJhncg")
	public ModelAndView saveJhncg(HttpServletRequest request,HttpServletResponse response) throws Exception{
		SysUserDetails sysUserDetails =	(SysUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		String gyh = sysUserDetails.getGyh();
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		
		String xmmc = RequestUtils.getStringParameter(request, "xmmc");
		String nhsyl = RequestUtils.getStringParameter(request, "nhsyl");
		String qx_month = RequestUtils.getStringParameter(request, "qx_month");
		String qx_day = RequestUtils.getStringParameter(request, "qx_day");
		String fbsj = RequestUtils.getStringParameter(request, "fbsj");
		String jxrq = RequestUtils.getStringParameter(request, "jxrq");
		String jbrq = RequestUtils.getStringParameter(request, "jbrq");
		String mjq = RequestUtils.getStringParameter(request, "mjq");
		String xmje = RequestUtils.getStringParameter(request, "xmje");
		String xmlx = RequestUtils.getStringParameter(request, "xmlx");
		String fbr = RequestUtils.getStringParameter(request, "fbr");
		String sjhm = RequestUtils.getStringParameter(request, "sjhm");
		String gridId = RequestUtils.getStringParameter(request, "gridId");
		String xyjb = RequestUtils.getStringParameter(request, "xyjb");
		String tbfw = RequestUtils.getStringParameter(request, "tbfw");
		String jhjs = RequestUtils.getStringParameter(request, "jhjs");
		
		String gridFbje = RequestUtils.getStringParameter(request, "gridFbje");
		
		params.put("xmmc", xmmc);
		params.put("xyjb", xyjb);
		params.put("tbfw", tbfw);
		params.put("jhjs", jhjs);
		params.put("nhsyl", nhsyl);
		params.put("qx_month", qx_month);
		params.put("qx_day", qx_day);
		params.put("fbsj", fbsj);
		params.put("jxrq", jxrq);
		params.put("jbrq", jbrq);
		params.put("mjq", mjq);
		params.put("xmje", xmje);
		params.put("xmlx", xmlx);
		params.put("fbr", fbr);
		params.put("sjhm", sjhm);
		params.put("gridId", gridId);
		params.put("gridFbje", gridFbje);
		result.put("success", true);
		//判断所选的债权是否可用,多用户同时操作同一个债权
		String[] gridIds=gridId.split(",");
		String[] gridFbjes=gridFbje.split(",");
		if (gridIds.length<=0) {//未选择债权时
			result.put("isNoGridId", false);
			result.put("isAddSuc", false);
			serialize(request,response,result);
			return null;
		}
		JSONObject paramId = new JSONObject();
		synchronized(this){//同步锁
			int i=0;
		for (String string : gridIds) {
			paramId.put("bizId", string);
			paramId.put("fbje", gridFbjes[i]);
			Map<String, Object> map=jhnxmService.getJhnzqInfo(paramId);
			i++;
			if (map.containsKey("ZQ_STATE") && "02".equals(map.get("ZQ_STATE"))) {//选择的债券失效时
				result.put("isZqKy", false);
				result.put("isAddSuc", false);
				serialize(request,response,result);
				return null;
			}
		}
		boolean bool=jhnxmService.saveJhncg(params);
		result.put("isAddSuc", bool);
		serialize(request,response,result);
		}
		return null;
	}
	/**
	 * 
	 * @param request 发标申请 删除功能
	 * @param response
	 * @return
	 * @throws Exception
	 */
	/*@RequestMapping("/deleteJhncg")
	public ModelAndView deleteJhncg(HttpServletRequest request,HttpServletResponse response) throws Exception{
		SysUserDetails sysUserDetails =	(SysUserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String bizId = RequestUtils.getStringParameter(request, "bizId");
		String gyh=sysUserDetails.getGyh();
		params.put("cgid", bizId);
		try{
			Map<String,Object> zqInfoMap = jhnxmService.getJhncgInfo(params);
			if(null !=zqInfoMap){
				if(zqInfoMap.containsKey("XM_ZT") && "1".equals(zqInfoMap.get("XM_ZT")) && gyh.equals(zqInfoMap.get("XM_SQ_USER_ID"))){
					params.put("bizId", bizId);
					params.put("xmzt", "1");
					jhnxmService.deleteJhncg(params);
					result.put("isDeleteSuc", true);
					result.put("msg", "删除成功!");
				}else{
					result.put("isDeleteSuc", false);
					result.put("msg", "对不起,无法删除非本人申请记录!");
				}
			}else{
				result.put("isDeleteSuc", false);
				result.put("msg", "对不起,信息不存在!");
			}
		}catch(Exception e){
			e.printStackTrace();
			result.put("isDeleteSuc", false);
			result.put("msg", "对不起,数据异常!");
			logger.info("deleteJhnzq 删除计划内项目失败！"+ params.toString());
		}
		result.put("success", true);
		serialize(request,response,result);
		return null;
	}*/
	/**
	 * 申请发标，根据期限(月)，获得实际天数
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/getQxDayByQxMonth")
	public ModelAndView getQxDayByQxMonth(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		String qxMonth = RequestUtils.getStringParameter(request, "qxMonth");
		int qxDay = this.jhnxmService.getQxDayByQxMonth(qxMonth);
		if(qxDay > 0){
			result.put("success", true);
			result.put("msg", "获取实际期限(天)成功！");
			result.put("qxDay", qxDay);
		}else{
			result.put("success", false);
			result.put("msg", "获取实际期限(天)失败！");
			result.put("qxDay", qxDay);
		}
		serialize(request,response,result);
		return null;
	}
	/**
	 * 
	 * @param request 申请发标 草稿查看
	 * @param response 查看功能
	 * @return
	 * @throws Exception
	 */
	
	@RequestMapping("/queryJhncgViewList")
	public ModelAndView queryJhncgViewList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		String xmcgid = RequestUtils.getStringParameter(request, "xmcgid");
		List list = jhnxmService.queryJhncgViewList(xmcgid);
		int count = jhnxmService.getJhncgViewCount(xmcgid);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 savejhnsh  
	 * @功能 TODO 项目草稿审核
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/saveJhnsh")
	public ModelAndView saveJhnsh(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		result.put("success", true);
		JSONObject params = new JSONObject();
		String xmcgid = RequestUtils.getStringParameter(request, "xmcgid");
		String shr = RequestUtils.getStringParameter(request, "shr");
		String xmzt = RequestUtils.getStringParameter(request, "sh_state");
		String xmbz = RequestUtils.getStringParameter(request, "sh_content");
		params.put("cgid", xmcgid);
		params.put("shr", shr);
		params.put("xmzt", xmzt);
		params.put("xmbz", xmbz);
		Map<String, Object> xmcgMap = jhnxmService.getJhncgInfo(params);
		if(null == xmcgMap){
			result.put("isSHSuc", false);
			result.put("msg", "信息有误！");
		}else if(xmcgMap.containsKey("XM_ZT")){
			Object stateObj = xmcgMap.get("XM_ZT");
			if(null != stateObj && stateObj.toString().equals("1")){//待审核状态才可以审核
				try{
					boolean isSHSuc = jhnxmService.saveJhnsh(params);
					result.put("isSHSuc", isSHSuc);
				}catch (Exception e) {
					e.printStackTrace();
					result.put("isSHSuc", false);
					result.put("msg", "审核失败！");
				}
			}else{//无审核状态信息,无法审核
				result.put("isSHSuc", false);
				result.put("msg", "该申请已审核过，请勿重复操作！");
			}
		}
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 queryJhnlbList  
	 * @功能 TODO 查询审核通过后项目列表
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryJhnlbList")
	public ModelAndView queryJhnlbList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String startDate = RequestUtils.getStringParameter(request, "startDate");
		String endDate = RequestUtils.getStringParameter(request, "endDate");
		
		String cxmmc = RequestUtils.getStringParameter(request, "cxmmc");
		String cfbr = RequestUtils.getStringParameter(request, "cfbr");
		String cxmlx = RequestUtils.getStringParameter(request, "cxmlx");
		String cxmzt = RequestUtils.getStringParameter(request, "cxmzt");
		String zhzt = RequestUtils.getStringParameter(request, "zhzt");
		params.put("start", start);
		params.put("limit", limit);
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("cxmmc", cxmmc);
		params.put("cfbr", cfbr);
		params.put("cxmlx", cxmlx);
		params.put("cxmzt", cxmzt);
		params.put("zhzt", zhzt);
		List list = jhnxmService.queryJhnlbList(params);
		int count = jhnxmService.getJhnlbCount(params);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 queryJhnxmzqViewList  
	 * @功能 TODO 查看项目 所属债权
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryJhnxmzqViewList")
	public ModelAndView queryJhnxmzqViewList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String xmid = RequestUtils.getStringParameter(request, "xmid");
		params.put("xmid", xmid);
		String zhzt = RequestUtils.getStringParameter(request, "zhzt");
		params.put("zhzt", zhzt);
		List list = jhnxmService.queryJhnxmzqViewList(params);
		int count = jhnxmService.getJhnxmzqViewCount(params);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 saveJhnzhSQ  
	 * @功能 TODO 保存置换债权申请
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/saveJhnzhSQ")
	public ModelAndView saveJhnzhSQ(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		
		String tqsh_sqr = RequestUtils.getStringParameter(request, "tqsh_sqr");
		String tqsh_sqbz = RequestUtils.getStringParameter(request, "tqsh_sqbz");
		String tqshOutId = RequestUtils.getStringParameter(request, "tqshOutId");
		String tqshInId = RequestUtils.getStringParameter(request, "tqshInId");
		
		params.put("zq_tqsh_sqr", tqsh_sqr);
		params.put("zq_tqsh_sqbz", tqsh_sqbz);
		params.put("tqshOutId", tqshOutId);
		params.put("tqshInId", tqshInId);
		result.put("success", true);
		//判断所选的债权是否可用,多用户同时操作同一个债权
		if (StringUtils.isEmpty(tqshInId)||StringUtils.isEmpty(tqshOutId)) {//无置换时
			result.put("msg", "未置换债权,请勿保存!");
			result.put("isAddSuc", false);
			serialize(request,response,result);
			return null;
		}
		JSONObject paramId = new JSONObject();
		synchronized(this){//同步锁
			paramId.put("bizId", tqshInId);
			Map<String, Object> map=jhnxmService.getJhnzqInfo(paramId);
			if (map.containsKey("ZQ_STATE") && "01".equals(map.get("ZQ_STATE"))||"02".equals(map.get("ZQ_STATE"))) {//选择的债券被使用或失效时
				result.put("msg", "置换入的债权,已用或失效!");
				result.put("isAddSuc", false);
				serialize(request,response,result);
				return null;
			}
		boolean bool=jhnxmService.saveJhnzhSQ(params);
		result.put("isAddSuc", bool);
		serialize(request,response,result);
		}
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 saveJhnzhSH  
	 * @功能 TODO 保存置换债权 审核
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/saveJhnzhSH")
	public ModelAndView saveJhnzhSH(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String sqid = RequestUtils.getStringParameter(request, "sqid");
		String shzt = RequestUtils.getStringParameter(request, "shzt");
		String djje = RequestUtils.getStringParameter(request, "djje");
		String yyje = RequestUtils.getStringParameter(request, "yyje");
		String tqsh_shr = RequestUtils.getStringParameter(request, "tqsh_shr");
		String tqsh_shbz = RequestUtils.getStringParameter(request, "tqsh_shbz");
		String tqshOutId = RequestUtils.getStringParameter(request, "tqshOutId");
		String tqshInId = RequestUtils.getStringParameter(request, "tqshInId");
		
		params.put("sqid", sqid);
		params.put("shzt", shzt);
		params.put("djje", djje);
		params.put("yyje", yyje);
		params.put("tqsh_shr", tqsh_shr);
		params.put("tqsh_shbz", tqsh_shbz);
		params.put("tqshOutId", tqshOutId);
		params.put("tqshInId", tqshInId);
		result.put("success", true);
		//判断所选的债权是否可用,多用户同时操作同一个债权
		if (StringUtils.isEmpty(tqshInId)||StringUtils.isEmpty(tqshOutId)) {//无置换时
			result.put("msg", "数据有误请重新操作!");
			result.put("isAddSuc", false);
			serialize(request,response,result);
			return null;
		}
		boolean bool=jhnxmService.saveJhnzhSH(params);
		result.put("isAddSuc", bool);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 queryJhnzhList  
	 * @功能 TODO 查询置换债权申请 列表
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryJhnzhList")
	public ModelAndView queryJhnzhList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String startDate = RequestUtils.getStringParameter(request, "startDate");
		String endDate = RequestUtils.getStringParameter(request, "endDate");
		
		String czqmc = RequestUtils.getStringParameter(request, "czqmc");
		String cssr = RequestUtils.getStringParameter(request, "cssr");
		String clrr = RequestUtils.getStringParameter(request, "clrr");
		String cxmlx = RequestUtils.getStringParameter(request, "cxmlx");
		String cxmzt = RequestUtils.getStringParameter(request, "cxmzt");
		String kyje = RequestUtils.getStringParameter(request, "kyje");
		String zhzt = RequestUtils.getStringParameter(request, "czhzt");
		params.put("start", start);
		params.put("limit", limit);
		params.put("startDate", startDate);
		params.put("endDate", endDate);
		params.put("czqmc", czqmc);
		params.put("cssr", cssr);
		params.put("clrr", clrr);
		params.put("cxmlx", cxmlx);
		params.put("cxmzt", cxmzt);
		params.put("kyje", kyje);
		params.put("zhzt", zhzt);
		List<Map<String, Object>> list = jhnxmService.queryJhnzhList(params);
		int count = jhnxmService.getJhnzhCount(params);
		result.put("data", list);	
		result.put("total", count);
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 queryJhnzhViewList  
	 * @功能 TODO 查看置换债权申请 所属债权
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryJhnzhViewList")
	public ModelAndView queryJhnzhViewList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		String zhc_zqid = RequestUtils.getStringParameter(request, "zhc_zqid");
		String zhr_zqid = RequestUtils.getStringParameter(request, "zhr_zqid");
		String zhsq_id = RequestUtils.getStringParameter(request, "zhsq_id");
		params.put("zhc_zqid", zhc_zqid);
		params.put("zhr_zqid", zhr_zqid);
		params.put("zhsq_id", zhsq_id);
		List<Map<String, Object>> list = jhnxmService.queryJhnzhViewList(params);
		result.put("data", list);	
		serialize(request,response,result);
		return null;
	}
	/**
	 * @作者 js  
	 * @方法名 queryTjrsjhmList  
	 * @功能 TODO 搜索用户手机号码
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	@RequestMapping("/queryTjrsjhmList")
	public ModelAndView queryTjrsjhmList(HttpServletRequest request,HttpServletResponse response) throws Exception{
		JSONObject result = new JSONObject();
		JSONObject params = new JSONObject();
		Integer start = RequestUtils.getIntParameter(request, "start");
		Integer limit = RequestUtils.getIntParameter(request, "limit");
		String sjhm = RequestUtils.getStringParameter(request, "sjhm");
		params.put("start", start);
		params.put("limit", limit);
		params.put("sjhm", sjhm);
		List<Map<String, Object>> list = jhnxmService.queryTjrsjhmList(params);
		result.put("data", list);	
		serialize(request,response,result);
		return null;
	}
	
}
	
